import React from "react";
import {Constant} from "../utils/BaseConstant";
import cookie from "react-cookie";
class AddStaffMenu extends React.Component {
    constructor(props) {
        super(props);
    }

    render() {
        let {isShow} = this.props;
        let userRight = cookie.load("userRight");
        if (isShow && userRight == 1) {
            return (
                <div className="add-staff-menu-container">
                    <button onClick={this._addStaff.bind(this, Constant.CASHIER)}>+收银员</button>
                    <div className="management-staff-space"></div>
                    <button onClick={this._addStaff.bind(this, Constant.ACCOUNTANT)}>+财务</button>
                    <div className="management-staff-space"></div>
                    <button onClick={this._addStaff.bind(this, Constant.ADMIN)}>+管理员</button>
                </div>
            );
        } else if (isShow && userRight != 1) {
            return (
                <div className="add-staff-menu-container">
                    <button onClick={this._addStaff.bind(this, Constant.CASHIER)}>+收银员</button>
                    <div className="management-staff-space"></div>
                    <button onClick={this._addStaff.bind(this, Constant.ACCOUNTANT)}>+财务</button>
                </div>
            );
        } else {
            return (
                <div></div>
            );
        }
    }

    _addStaff(type) {
        let shopNo = this.props.item;
        window.location.href = "/#/pay/addEmployee?staffType=" + type + "&shopNo=" + shopNo;
    }
}

export default  AddStaffMenu;